HDDS-1981: Datanode should sync db when container is moved to CLOSED or QUASI_CLOSED state#1319
Conversation
|
@supratimdeka Can you please review the PR? |
|
💔 -1 overall
This message was automatically generated. |
| // Close container is not expected to be instantaneous. | ||
| compactDB(); | ||
| // We must sync the DB after close operation | ||
| flushAndSyncDB(); |
There was a problem hiding this comment.
updateContainerData takes care to revert the state of the container in case of failure.
Won't that be a problem with flushDB? If flush fails, don't we want the container to remain Open?
Also, related question : what should be the relative order - sync first and then change state to close, both with the writeLock held
Same question applies to quasiClose as well.
There was a problem hiding this comment.
The recent commit moves sync before state change. Any failure in flush should now move to container to UNHEALTHY state in HddsDispatcher#dispatchRequest.
| @@ -318,6 +326,8 @@ public void close() throws StorageContainerException { | |||
| // It is ok if this operation takes a bit of time. | |||
| // Close container is not expected to be instantaneous. | |||
| compactDB(); | |||
There was a problem hiding this comment.
question unrelated to this patch : why do we need to run compact during close? what is the benefit?
There was a problem hiding this comment.
Good question. I feel we don't have to run compactDB in quasi close or close.
|
Thanks @lokeshj1703 for working on this. I think running explicit compaction before close might make it heavy operation. Can we run compaction in the background or in a separate thread after closing the container? |
|
💔 -1 overall
This message was automatically generated. |
|
@supratimdeka @bshashikant Thanks for reviewing the PR! I have pushed a commit addressing your comments. |
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
Thanks @lokeshj1703 for updating the patch . The patch looks good to me. I am +1 on this change. |
|
@bshashikant @supratimdeka @nandakumar131 Thanks for reviewing the PR. I have merged it with trunk. |
…or QUASI_CLOSED state (apache#1319)
…or QUASI_CLOSED state (apache#1319)
Datanode should sync db when container is moved to CLOSED or QUASI_CLOSED state. This will ensure that the metadata of a container is persisted.